﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using bts_webapp.Models;
using System.Web.UI;

namespace bts_webapp
{
    public class Common
    {
        /// <summary>
        /// Get the current logged in user.
        /// </summary>
        public static VIBA_User CurrentUser
        {
            get
            {
                return (VIBA_User)HttpContext.Current.Session["CurrentUser"];
            }
            set
            {
                HttpContext.Current.Session["CurrentUser"] = value;
            }

        }

        public static List<VIBA_QUYEN> PermissionList
        {
            get 
            {
                return (List<VIBA_QUYEN>)HttpContext.Current.Session["PermissionList"];
            }
            set
            {
                HttpContext.Current.Session["PermissionList"] = value;
            }
        }

        public static string GetNewUserId()
        {
            var guid = Guid.NewGuid().ToString();
            var index = guid.IndexOf("-");
            return guid.Substring(0, index);
        }

    }
}